<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>微信跳转</title>
	<script src="/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.6.0.js "></script>
<script type="text/javascript">
        var data1=localStorage.getItem("wxConfig");
        console.log(data1)
        var di1 = $.parseJSON(data1)
        console.log(di1)
	    wx.config({
		  debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印
		  appId: di1.appId, // 必填，公众号的唯一标识
		  timestamp: di1.timestamp, // 必填，生成签名的时间戳
		  nonceStr: di1.nonceStr, // 必填，生成签名的随机串
		  signature: di1.signature,// 必填，签名
		  jsApiList: ['getLocation','openTagList'], // 必填，需要使用的JS接口列表
		  openTagList: ['wx-open-launch-weapp'] // 可选，需要使用的开放标签列表，例如['wx-open-launch-app']
		});
        localStorage.removeItem("wxConfig");

</script>
</head>

<body>
	<wx-open-launch-weapp id="launch-btn" username="gh_caccbc989b51" path="pages/home/index">
	  <template>
	    <style>.btn { padding: 12px }</style>
	    <button class="btn">打开小程序</button>
	  </template>
</wx-open-launch-weapp>
<script>
  var btn = document.getElementById('launch-btn');
  btn.addEventListener('launch', function (e) {
    console.log('success');
  });
  btn.addEventListener('error', function (e) {
    console.log('fail', e.detail);
  });
</script>
</div>
</body>
</html>
